<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/WEB-INF/templates/basic_template.xhtml">
	<ui:define name="content">
		<h:form id="form">
			<br />
				<p:fieldset legend="Tipo de controlador">
					<h:panelGrid id="grid" columns="2" style="margin-bottom:1px"
						cellpadding="5">
						<h:outputLabel for="nome" value="Nome:" />
						<p:inputText id="nome" value="#{experimentMBean.experiment.name}"
							size="18" />

						<h:outputText value="Modo:" />
						<p:selectOneMenu effect="none"
							value="#{experimentMBean.modoControle}">
							<p:ajax update="tudo" event="change" immediate="true" />
							<f:selectItem itemValue="-1" itemLabel="Selecione..." />
							<f:selectItem itemValue="0" itemLabel="Manual" />
							<f:selectItem itemValue="1" itemLabel="Automático" />
						</p:selectOneMenu>

					</h:panelGrid>
				</p:fieldset>
				<br />

				<p:fieldset id="tudo" legend="Parâmetros do controlador">

					<h:panelGroup rendered="#{experimentMBean.modoControle == -1}">
						<h:outputText value="Selecione um modo..." />
					</h:panelGroup>

					<h:panelGroup rendered="#{experimentMBean.modoControle > 0}">
						<h:panelGrid columns="2" style="margin-bottom:1px" cellpadding="5">
							<h:outputLabel for="setPoint" value="Setpoint: " />
							<p:spinner id="setPoint" min="0" max="30" size="4"
								value="#{experimentMBean.experiment.setPoint}" />
						</h:panelGrid>
						<hr />
					</h:panelGroup>

					<!-- FORMULÁRIO DE CADASTRO MALHA ABERTA -->
					<h:panelGroup id="formOpenLoop"
						rendered="#{experimentMBean.modoControle == 0}">
						<ui:include src="formOpenLoop.xhtml" />
					</h:panelGroup>

					<!-- FORMULÁRIO DE CADASTRO PID -->
					<h:panelGroup id="formPID"
						rendered="#{experimentMBean.modoControle == 1}">
						<ui:include src="formPID.xhtml" />
					</h:panelGroup>

				</p:fieldset>
				<br/>
				
				<!-- Reserva de horário -->
				<ui:include src="reservaHorarios.xhtml" />

				<h:panelGrid columns="2" style="margin-bottom:1px" cellpadding="5">
					<p:commandButton value="Cancelar" id="cancelar" />
					<p:commandButton action="#{experimentMBean.cadastrar}"
						value="Salvar" id="salvar" />
				</h:panelGrid>

			
		</h:form>
<!-- 		<script type="text/javascript" src="/WEB-INF/js/translate.js" /> -->
	</ui:define>
</ui:decorate>
</html>